This jupyter notebook contains some preliminary 'analyses'/visualisation of the COINS-MEG MEG data. The inputted data is the maxfiltered and preprocessed version. Note that this shows example outputs from subject 12, run 1 only.
# Load packages
from matplotlib import pyplot as plt
import mne
import osl
import numpy as np
import os
import pandas as pd
from mne.preprocessing import create_eog_epochs
# Read in the data ####
basedir = '/Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/'
#basedir = '/ohba/pi/lhunt/datasets/coins-meg_meg-analysis'
subj = 12
run = 1
ifMaxfiltered = True # set to true so that directories point to maxfiltered data
# Set directory paths
procdir = os.path.join(basedir, 'preprocessed', f'sub-{subj}', f'run-{run}') # directory for the processed data
if ifMaxfiltered == False:
dir_meg = os.path.join(procdir, 'meg', 'nomax')
else:
dir_meg = os.path.join(procdir, 'meg', 'max') # folder where maxfiltered versions live
dir_meg_derivatives = os.path.join(dir_meg, 'derivatives') # for storing derivatives from processing (eg fif files)
dir_meg_plots = os.path.join(dir_meg, 'plots') # for storing plots generated during preprocessing
# Read in the MEG data
# Get the filename for a specific subject and run
if ifMaxfiltered == False:
preproc_fname = os.path.join(dir_meg_derivatives,
f'sub-{subj}_ses-2-meg_task-coinsmeg_run-{run}_meg_preproc_raw.fif')
else:
preproc_fname = os.path.join(dir_meg_derivatives,
f'sub-{subj}_ses-2-meg_task-coinsmeg_run-{run}_meg_transsss_preproc_raw.fif')
clean = mne.io.read_raw_fif(preproc_fname, preload=True)
Opening raw data file /Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/preprocessed/sub-12/meg/max/derivatives/sub-12_ses-2-meg_task-coinsmeg_run-1_meg_transsss_preproc_raw.fif...
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) /Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/analysis/prelim-analysis.ipynb Cell 5 line 2 <a href='vscode-notebook-cell:/Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/analysis/prelim-analysis.ipynb#W4sZmlsZQ%3D%3D?line=17'>18</a> else: <a href='vscode-notebook-cell:/Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/analysis/prelim-analysis.ipynb#W4sZmlsZQ%3D%3D?line=18'>19</a> preproc_fname = os.path.join(dir_meg_derivatives, <a href='vscode-notebook-cell:/Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/analysis/prelim-analysis.ipynb#W4sZmlsZQ%3D%3D?line=19'>20</a> f'sub-{subj}_ses-2-meg_task-coinsmeg_run-{run}_meg_transsss_preproc_raw.fif') ---> <a href='vscode-notebook-cell:/Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/analysis/prelim-analysis.ipynb#W4sZmlsZQ%3D%3D?line=21'>22</a> clean = mne.io.read_raw_fif(preproc_fname, preload=True) File ~/opt/anaconda3/envs/osl-ws/lib/python3.8/site-packages/mne/io/fiff/raw.py:482, in read_raw_fif(fname, allow_maxshield, preload, on_split_missing, verbose) 442 @fill_doc 443 def read_raw_fif(fname, allow_maxshield=False, preload=False, 444 on_split_missing='raise', verbose=None): 445 """Reader function for Raw FIF data. 446 447 Parameters (...) 480 are updated accordingly. 481 """ --> 482 return Raw(fname=fname, allow_maxshield=allow_maxshield, 483 preload=preload, verbose=verbose, 484 on_split_missing=on_split_missing) File <decorator-gen-262>:12, in __init__(self, fname, allow_maxshield, preload, on_split_missing, verbose) File ~/opt/anaconda3/envs/osl-ws/lib/python3.8/site-packages/mne/io/fiff/raw.py:81, in Raw.__init__(self, fname, allow_maxshield, preload, on_split_missing, verbose) 78 next_fname = fname 79 while next_fname is not None: 80 raw, next_fname, buffer_size_sec = \ ---> 81 self._read_raw_file(next_fname, allow_maxshield, 82 preload, do_check_ext) 83 do_check_ext = False 84 raws.append(raw) File <decorator-gen-263>:12, in _read_raw_file(self, fname, allow_maxshield, preload, do_check_ext, verbose) File ~/opt/anaconda3/envs/osl-ws/lib/python3.8/site-packages/mne/io/fiff/raw.py:146, in Raw._read_raw_file(self, fname, allow_maxshield, preload, do_check_ext, verbose) 144 check_fname(fname, 'raw', endings) 145 # filename --> 146 fname = _check_fname(fname, 'read', True, 'fname') 147 ext = os.path.splitext(fname)[1].lower() 148 whole_file = preload if '.gz' in ext else False File <decorator-gen-0>:12, in _check_fname(fname, overwrite, must_exist, name, need_dir, verbose) File ~/opt/anaconda3/envs/osl-ws/lib/python3.8/site-packages/mne/utils/check.py:245, in _check_fname(fname, overwrite, must_exist, name, need_dir, verbose) 242 raise PermissionError( 243 f'{name} does not have read permissions: {fname}') 244 elif must_exist: --> 245 raise FileNotFoundError(f'{name} does not exist: {fname}') 247 return fname FileNotFoundError: fname does not exist: /Users/amyli/Desktop/LH-lab/coins-meg_meg-analysis/preprocessed/sub-12/meg/max/derivatives/sub-12_ses-2-meg_task-coinsmeg_run-1_meg_transsss_preproc_raw.fif
# Define the events
events = mne.find_events(clean, min_duration=0.005)
event_color = {}
event_dict = {'laserHit': 1, 'laserMiss': 2, 'keyRight': 3, 'keyLeft': 4, 'keyUp': 5, 'keyDown': 6, 'keyRelease': 7}
# Create epochs (-0.5 to 1.0s epoch around event)
epochs = mne.Epochs(clean, events, tmin=-0.5, tmax=1.0, event_id=event_dict) # -0.5-1.0
print(epochs)
# Remove epochs with particularly high peak-to-peak amplitudes, as this indicates there might still
# be segments in the data with high variance, that we didn't find earlier. We also include EOG peak-to-peak
# amplitude, as high amplitudes indicate saccades.
epochs.drop_bad({"eog": 6e-4, "mag": 4e-11, "grad": 4e-10}) # defines specific thresholds for peak-to-peak amplitudes in different types of channels
# Plot % of epochs dropped
epochs.plot_drop_log();
2916 events found
Event IDs: [ 1 2 3 4 5 6 7 10 20 100 105]
Not setting metadata
2906 matching events found
Setting baseline interval to [-0.5, 0.0] sec
Applying baseline correction (mode: mean)
0 projection items activated
<Epochs | 2906 events (good & bad), -0.5 - 1 sec, baseline -0.5 – 0 sec, ~6.4 MB, data not loaded,
'laserHit': 1480
'laserMiss': 576
'keyRight': 215
'keyLeft': 182
'keyUp': 27
'keyDown': 22
'keyRelease': 404>
Using data from preloaded Raw for 2906 events and 1501 original time points ...
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG001', 'EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001', 'EOG002']
Rejecting epoch based on EOG : ['EOG001', 'EOG002']
Rejecting epoch based on EOG : ['EOG001', 'EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
401 bad epochs dropped
# Use equalize_event_counts() to randomly sample epochs from each condition to match the number
# of epochs present in the condition w/ the fewest good epochs
conditions = ["laserHit", "laserMiss"]
epochs.equalize_event_counts(conditions)
hit_epochs = epochs["laserHit"]
miss_epochs = epochs["laserMiss"]
Dropped 746 epochs: 48, 49, 79, 80, 81, 82, 83, 84, 87, 93, 97, 98, 99, 100, 101, 102, 103, 110, 112, 114, 117, 120, 122, 124, 125, 126, 127, 130, 132, 134, 135, 136, 137, 140, 141, 142, 143, 144, 145, 159, 160, 163, 166, 175, 177, 182, 184, 186, 192, 194, 209, 212, 213, 238, 239, 240, 241, 242, 243, 246, 249, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 269, 272, 273, 274, 275, 278, 279, 280, 281, 284, 285, 288, 291, 292, 295, 296, 297, 298, 299, 300, 304, 306, 309, 310, 311, 314, 315, 326, 327, 328, 329, 330, 335, 336, 339, 340, 341, 350, 356, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 372, 373, 374, 375, 376, 377, 378, 381, 382, 383, 386, 387, 388, 393, 395, 397, 400, 401, 404, 405, 406, 407, 408, 411, 412, 413, 414, 417, 418, 419, 420, 421, 424, 425, 426, 427, 428, 429, 431, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 449, 450, 451, 458, 459, 460, 461, 463, 465, 466, 467, 468, 469, 472, 475, 476, 485, 488, 489, 492, 507, 512, 519, 520, 521, 533, 534, 535, 536, 539, 540, 541, 542, 543, 544, 545, 547, 548, 549, 550, 552, 553, 554, 555, 556, 557, 574, 576, 577, 578, 579, 580, 582, 593, 595, 597, 598, 599, 600, 603, 604, 605, 606, 607, 608, 609, 612, 613, 614, 644, 646, 647, 649, 650, 651, 653, 654, 655, 656, 657, 658, 659, 660, 661, 664, 666, 668, 669, 670, 673, 674, 677, 680, 688, 689, 691, 695, 697, 706, 707, 708, 715, 754, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 802, 803, 804, 805, 806, 807, 809, 810, 811, 812, 813, 814, 884, 885, 886, 887, 891, 893, 895, 897, 898, 899, 900, 902, 903, 905, 908, 910, 911, 913, 915, 916, 917, 918, 919, 921, 923, 924, 925, 935, 937, 938, 940, 941, 944, 945, 946, 947, 948, 949, 950, 951, 957, 960, 961, 962, 963, 964, 971, 976, 977, 980, 985, 986, 996, 998, 1002, 1004, 1009, 1010, 1011, 1012, 1023, 1025, 1026, 1027, 1030, 1032, 1034, 1035, 1038, 1039, 1041, 1044, 1049, 1050, 1051, 1064, 1069, 1071, 1072, 1074, 1075, 1076, 1081, 1083, 1085, 1086, 1089, 1090, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1102, 1105, 1106, 1111, 1112, 1115, 1128, 1129, 1130, 1275, 1276, 1277, 1278, 1279, 1290, 1291, 1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1498, 1500, 1501, 1506, 1508, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1521, 1522, 1523, 1579, 1581, 1583, 1588, 1590, 1594, 1597, 1600, 1601, 1602, 1603, 1606, 1608, 1609, 1611, 1612, 1613, 1618, 1621, 1622, 1623, 1629, 1630, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1655, 1656, 1660, 1691, 1692, 1693, 1704, 1705, 1707, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1740, 1742, 1743, 1744, 1745, 1748, 1749, 1751, 1753, 1754, 1755, 1758, 1759, 1760, 1761, 1762, 1763, 1765, 1766, 1767, 1768, 1769, 1784, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1799, 1800, 1801, 1802, 1809, 1810, 1813, 1824, 1825, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1849, 1862, 1863, 1866, 1887, 1888, 1889, 1890, 1893, 1896, 1897, 1898, 1899, 1973, 1974, 1975, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1987, 1988, 1989, 1992, 1994, 1995, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2031, 2033, 2035, 2036, 2037, 2038, 2045, 2053, 2055, 2056, 2059, 2060, 2061, 2064, 2065, 2068, 2069, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2095, 2096, 2105, 2106, 2107, 2108, 2109, 2110, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2121, 2122, 2123, 2124, 2135, 2136, 2194, 2195, 2196, 2197, 2198, 2200, 2201, 2202, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2312, 2314, 2323, 2324, 2327, 2328, 2331, 2332, 2333, 2334, 2339, 2341, 2345, 2347, 2373, 2374, 2378, 2384, 2386, 2391, 2393, 2395, 2397, 2402, 2403, 2404, 2407, 2408, 2412, 2413, 2417, 2418, 2419, 2420, 2421, 2463, 2465, 2467, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502
First visualise ERFs for all channels, for both magnetometers and gradiometers.
# Compute average evoked responses for hit and miss epochs
## hit ERFs
evoked_hit = hit_epochs.average()
evoked_hit.plot_joint(picks='mag')
evoked_hit.plot_joint(picks='grad');
No projector specified for this dataset. Please consider the method self.add_proj.
No projector specified for this dataset. Please consider the method self.add_proj.
Visualise ERFs for centroparietal channels only (magnetometers).
### centroparietal only
roi_cp = ['MEG0731', 'MEG0741', 'MEG1831', 'MEG2241'] # define roi over centroparietal sensors
evoked_hit.plot_joint(picks=roi_cp)
No projector specified for this dataset. Please consider the method self.add_proj.
<Figure size 640x480 with 0 Axes>
First visualise ERFs for all channels, for both magnetometers and gradiometers.
## miss ERFs
evoked_miss = miss_epochs.average()
evoked_miss.plot_joint(picks='mag')
evoked_miss.plot_joint(picks='grad');
No projector specified for this dataset. Please consider the method self.add_proj.
No projector specified for this dataset. Please consider the method self.add_proj.
Then visualise for only centroparietal channels (magnenometers).
### centroparietal only
evoked_miss.plot_joint(picks=roi_cp);
No projector specified for this dataset. Please consider the method self.add_proj.
First compare global field power for hits vs. misses; for both magnetometers and gradiometers.
## Compare hit vs miss evokeds, global field power
mne.viz.plot_compare_evokeds([evoked_hit, evoked_miss], picks='mag',
show_sensors='upper right')
mne.viz.plot_compare_evokeds([evoked_hit, evoked_miss], picks='grad',
show_sensors='upper right')
combining channels using "gfp" combining channels using "gfp"
combining channels using "gfp" combining channels using "gfp"
[<Figure size 800x600 with 2 Axes>]
First for all sensors...
## difference waveform hit-miss
### all sensors and topography
evokeds_diff_hitVsMiss = mne.combine_evoked([evoked_hit, evoked_miss], weights=[1, -1])
evokeds_diff_hitVsMiss.plot_joint(picks='mag')
evokeds_diff_hitVsMiss.plot_joint(picks='grad');
No projector specified for this dataset. Please consider the method self.add_proj.
No projector specified for this dataset. Please consider the method self.add_proj.
Then for centroparietal magnetometers only.
### cp sensors only
mne.viz.plot_compare_evokeds({'Hit-Miss':evokeds_diff_hitVsMiss},
picks=roi_cp, show_sensors='upper right',
combine='mean',
title='Difference Wave')
combining channels using "mean"
[<Figure size 800x600 with 2 Axes>]
# Create epochs for movement keys (left vs right)
epochs = mne.Epochs(clean, events, tmin=-3.0, tmax=1.0, event_id=event_dict) # different epoch times now compared to hit/miss
print(epochs)
# Remove epochs with particularly high peak-to-peak amplitudes, as we did for hit/miss epochs
epochs.drop_bad({"eog": 6e-4, "mag": 4e-11, "grad": 4e-10}) # defines specific thresholds for peak-to-peak amplitudes in different types of channels
epochs.plot_drop_log();
# use equalize_event_counts first to randomly sample epochs from each condition to match the number
# of epochs present in the condition w/ the fewest good epochs
conditions = ["keyLeft", "keyRight"]
epochs.equalize_event_counts(conditions)
left_epochs = epochs["keyLeft"]
right_epochs = epochs["keyRight"]
Not setting metadata
2906 matching events found
Setting baseline interval to [-3.0, 0.0] sec
Applying baseline correction (mode: mean)
0 projection items activated
<Epochs | 2906 events (good & bad), -3 - 1 sec, baseline -3 – 0 sec, ~6.4 MB, data not loaded,
'laserHit': 1480
'laserMiss': 576
'keyRight': 215
'keyLeft': 182
'keyUp': 27
'keyDown': 22
'keyRelease': 404>
Using data from preloaded Raw for 2906 events and 4001 original time points ...
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001']
Rejecting epoch based on EOG : ['EOG001', 'EOG002']
Rejecting epoch based on EOG : ['EOG001', 'EOG002']
Rejecting epoch based on EOG : ['EOG001', 'EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
Rejecting epoch based on EOG : ['EOG002']
702 bad epochs dropped
Dropped 40 epochs: 81, 101, 104, 108, 111, 114, 124, 131, 147, 166, 171, 173, 176, 183, 188, 194, 199, 203, 209, 213, 220, 224, 228, 243, 269, 279, 288, 437, 448, 468, 471, 477, 512, 521, 566, 574, 577, 605, 631, 676
# Compute average evoked responses for left and right epochs
evoked_left = left_epochs.average()
evoked_left.plot_joint(picks='mag')
evoked_left.plot_joint(picks='grad');
No projector specified for this dataset. Please consider the method self.add_proj.
No projector specified for this dataset. Please consider the method self.add_proj.
evoked_left.plot_joint(picks=roi_cp);
No projector specified for this dataset. Please consider the method self.add_proj.
evoked_right = right_epochs.average()
evoked_right.plot_joint(picks='mag')
evoked_right.plot_joint(picks='grad');
No projector specified for this dataset. Please consider the method self.add_proj.
No projector specified for this dataset. Please consider the method self.add_proj.
evoked_right.plot_joint(picks=roi_cp);
No projector specified for this dataset. Please consider the method self.add_proj.
First compare global field power for keyLeft vs. Right; for both magnetometers and gradiometers.
mne.viz.plot_compare_evokeds([evoked_left, evoked_right], picks='mag',
show_sensors='upper right')
mne.viz.plot_compare_evokeds([evoked_left, evoked_right], picks='grad',
show_sensors='upper right');
combining channels using "gfp" combining channels using "gfp"
combining channels using "gfp" combining channels using "gfp"
evokeds_diff_leftVsRight = mne.combine_evoked([evoked_left, evoked_right], weights=[1, -1])
evokeds_diff_leftVsRight.plot_joint(picks='mag')
evokeds_diff_leftVsRight.plot_joint(picks='grad');
No projector specified for this dataset. Please consider the method self.add_proj.
No projector specified for this dataset. Please consider the method self.add_proj.